package com.li.spring6.service.impl;

import com.li.spring6.dao.UserDao;
import com.li.spring6.dao.impl.UserDaoImplForMySQL;
import com.li.spring6.dao.impl.UserDaoImplForOracle;
import com.li.spring6.service.UserService;

public class UserServiceImpl implements UserService {
    //如果要修改数据库，就要修改已有代码，不符合开闭原则
//    UserDao userDao = new UserDaoImplForMySQL();

    //因为改了原先运行正常的程序，所以重新进行单元测试
    //尤其是银行系统，一旦修改了原有系统，所有模块都要重新进行单元测试
//    private UserDao userDao = new UserDaoImplForOracle();

    //面向接口编程：
    private UserDao userDao;

    @Override
    public void deleteUser() {
        //业务代码....
        userDao.deleteById();
    }

}

